package com.adapter.classAdapter;

//适配器类，继承被适配类，实现适配接口
public class VoltageAdapter extends Voltage220V implements Voltage5V{
    @Override
    public int output5v() {
        //拿到220v电源
        int v220 = output220V();
        System.out.println("电源电压："+v220+"V");
        System.out.println("适配器开始工作 .... ");
        //转为5v
        int v5 = v220 / 44 ;
        System.out.println("适配器转换后的电压为："+v5+"V");
        return v5;
    }
}
